home *** CD-ROM | disk | FTP | other *** search
/ Libris Britannia 4 / science library(b).zip / science library(b) / DTP / DTP_TEX / H220.ZIP / ITRNS211.ZIP / SRC / YTABC < prev    next >
Text File  |  1991-12-14  |  31KB  |  1,002 lines

  1. #ifndef lint
  2. static char yysccsid[] = "@(#)yaccpar     1.7 (Berkeley) 09/09/90";
  3. #endif
  4. #define YYBYACC 1
  5. #line 2 "iyacc.y"
  6. /*
  7.  *========================================================================== 
  8.  * Copyright 1991 Avinash Chopde, All Rights Reserved.
  9.  *
  10.  * Permission to use, copy, modify and distribute this software and its
  11.  * documentation for any purpose is hereby granted without fee, provided that
  12.  * the above copyright notice appear in all copies and that both that
  13.  * copyright notice and this permission notice appear in supporting
  14.  * documentation, and that the name of Avinash Chopde not be used in
  15.  * advertising or publicity pertaining to distribution of the software
  16.  * without specific, written prior permission.
  17.  * Avinash Chopde makes no representations about the suitability of this
  18.  * software for any purpose.
  19.  * It is provided "as is" without express or implied warranty.
  20.  *
  21.  * AVINASH CHOPDE DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE,
  22.  * INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS,
  23.  * IN NO EVENT SHALL AVINASH CHOPDE BE LIABLE FOR ANY SPECIAL, INDIRECT OR
  24.  * CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE,
  25.  * DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER
  26.  * TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE
  27.  * OF THIS SOFTWARE.
  28.  *
  29.  * Author:  Avinash Chopde, 1991
  30.  *        C2 Colonial Drive #4, Andover, MA 01810, USA.
  31.  *
  32.  */
  33.  
  34. static char S_RCSID[] = "$Header: e:/itrans/src/rcs/iyacc.y 1.5 91/10/12 21:54:01 avinash Exp $";
  35.  
  36. #include <stdio.h>
  37. #include "itrans.h"
  38.  
  39. int G_lineno = 1; /* GLOBAL var: used by lex to indicate current line number */
  40.  
  41. #define WORD_LEN    511
  42.  
  43. /* Define a struct to keep track of the components of the letter, and
  44.  * the text representation of the word being parsed.
  45.  */
  46. static struct {
  47.     char word[WORD_LEN+1];
  48.     int curr_letter[WORD_LEN+1]; /* collect tokens regarding this letter here */
  49.     int nolig[WORD_LEN+1];/*collect nolig tokens here (see itrans.h, letter_t)*/
  50.     int curr_letter_n; /* number of tokens in curr_letter */
  51.     int curr_type; /* type of letter - special, vowel, cons, etc */
  52. } S_word;
  53.  
  54. char G_endprev_str[LINELEN]; /* used by ilex.l to  pass string to
  55.                   * process in case of the ENDPREV_TOK
  56.                   */
  57.  
  58. #define ADD_TOKEN(t) {    \
  59.     S_word.nolig[S_word.curr_letter_n] = FALSE;        \
  60.     S_word.curr_letter[S_word.curr_letter_n++] = t;    \
  61.     strcat(S_word.word, yytext);            \
  62. }
  63.  
  64. #define ADD_TOKEN_TYPE(t, typ) {            \
  65.     ADD_TOKEN(t);                    \
  66.     S_word.curr_type = typ;                \
  67. }
  68.  
  69. /* forward declarations (for prototypes) */
  70.  
  71. static void S_init_command();
  72. static void S_end_command();
  73. static void S_init_word();
  74. static void S_end_word();
  75. static void S_end_letter();
  76. static void S_init_letter();
  77. static void S_handle_other(char*);
  78.  
  79. #line 80 "y_tab.c"
  80. #define DUMMY_TOK 257
  81. #define A_TOK 258
  82. #define AA_TOK 259
  83. #define I_TOK 260
  84. #define II_TOK 261
  85. #define U_TOK 262
  86. #define UU_TOK 263
  87. #define RI_TOK 264
  88. #define RII_TOK 265
  89. #define LI_TOK 266
  90. #define LII_TOK 267
  91. #define AY_TOK 268
  92. #define AAY_TOK 269
  93. #define AI_TOK 270
  94. #define O_TOK 271
  95. #define OO_TOK 272
  96. #define AU_TOK 273
  97. #define AM_TOK 274
  98. #define AHA_TOK 275
  99. #define KA_TOK 276
  100. #define KHA_TOK 277
  101. #define GA_TOK 278
  102. #define GHA_TOK 279
  103. #define NGA_TOK 280
  104. #define CHA_TOK 281
  105. #define CHHA_TOK 282
  106. #define JA_TOK 283
  107. #define JHA_TOK 284
  108. #define JNH_TOK 285
  109. #define TTA_TOK 286
  110. #define TTHA_TOK 287
  111. #define DDA_TOK 288
  112. #define DDHA_TOK 289
  113. #define NNA_TOK 290
  114. #define TA_TOK 291
  115. #define THA_TOK 292
  116. #define DA_TOK 293
  117. #define DHA_TOK 294
  118. #define NA_TOK 295
  119. #define PA_TOK 296
  120. #define PHA_TOK 297
  121. #define BA_TOK 298
  122. #define BHA_TOK 299
  123. #define MA_TOK 300
  124. #define YA_TOK 301
  125. #define RA_TOK 302
  126. #define LA_TOK 303
  127. #define VA_TOK 304
  128. #define SHA_TOK 305
  129. #define SHHA_TOK 306
  130. #define SA_TOK 307
  131. #define HA_TOK 308
  132. #define LDA_TOK 309
  133. #define KSHA_TOK 310
  134. #define GYA_TOK 311
  135. #define NNX_TOK 312
  136. #define NYA_TOK 313
  137. #define RRA_TOK 314
  138. #define KADOT_TOK 315
  139. #define KHADOT_TOK 316
  140. #define GADOT_TOK 317
  141. #define DDADOT_TOK 318
  142. #define DDHADOT_TOK 319
  143. #define JADOT_TOK 320
  144. #define PHADOT_TOK 321
  145. #define RA_HALF_TOK 322
  146. #define ANUSVARA_TOK 323
  147. #define CHANDRA_TOK 324
  148. #define CHANDRA_BN_TOK 325
  149. #define VIRAAM_TOK 326
  150. #define AVAGRAHA_TOK 327
  151. #define SRI_TOK 328
  152. #define AUM_TOK 329
  153. #define BLANK_TOK 330
  154. #define NEWLINE_TOK 331
  155. #define NOLIG_TOK 332
  156. #define COMMAND_TOK 333
  157. #define ENDPREV_TOK 334
  158. #define ILANG_TOK 335
  159. #define MARATHI_TOK 336
  160. #define HINDI_TOK 337
  161. #define TAMIL_TOK 338
  162. #define BENGALI_TOK 339
  163. #define TELUGU_TOK 340
  164. #define MALAYALAM_TOK 341
  165. #define GUJARATI_TOK 342
  166. #define ORIYA_TOK 343
  167. #define KANNADA_TOK 344
  168. #define SANSKRIT_TOK 345
  169. #define ENDLANG_TOK 346
  170. #define SETIFM_TOK 347
  171. #define SETFONT_TOK 348
  172. #define YYERRCODE 256
  173. short yylhs[] = {                                        -1,
  174.     0,    0,    0,    3,    0,    1,    1,    1,    1,    1,
  175.     1,    1,    1,    1,    1,    1,    2,    5,    2,    7,
  176.     2,    2,    2,    2,    4,    4,    4,    9,    9,   10,
  177.    10,   10,   13,   13,   13,   12,   12,   12,   12,   12,
  178.    12,   12,   12,   12,   12,   12,   12,   12,   12,   12,
  179.    12,   12,   12,   14,   14,   14,   14,   14,   14,   14,
  180.    14,   14,   14,   14,   14,   14,   14,   14,   14,   14,
  181.    14,   14,   14,   14,   14,   14,   14,   14,   14,   14,
  182.    14,   14,   14,   14,   14,   14,   14,   14,   14,   14,
  183.    14,   14,   14,   14,   14,   14,   14,   14,   14,   11,
  184.    11,   11,   11,   11,   11,   11,   11,    6,    8,    8,
  185.    15,   15,
  186. };
  187. short yylen[] = {                                         2,
  188.     0,    2,    2,    0,    5,    1,    1,    1,    1,    1,
  189.     1,    1,    1,    1,    1,    1,    0,    0,    3,    0,
  190.     3,    2,    2,    1,    1,    2,    2,    1,    1,    1,
  191.     2,    1,    1,    2,    2,    1,    1,    1,    1,    1,
  192.     1,    1,    1,    1,    1,    1,    1,    1,    1,    1,
  193.     1,    1,    1,    1,    1,    1,    1,    1,    1,    1,
  194.     1,    1,    1,    1,    1,    1,    1,    1,    1,    1,
  195.     1,    1,    1,    1,    1,    1,    1,    1,    1,    1,
  196.     1,    1,    1,    1,    1,    1,    1,    1,    1,    1,
  197.     1,    1,    1,    1,    1,    1,    1,    1,    1,    1,
  198.     1,    1,    1,    1,    1,    1,    1,    1,    1,    2,
  199.     1,    1,
  200. };
  201. short yydefred[] = {                                      1,
  202.     0,    8,    6,    7,    9,   11,   12,   13,   14,   15,
  203.    16,   10,    2,    3,    4,    0,   24,    0,  111,  112,
  204.    23,    5,    0,    0,    0,  109,   36,   37,   38,   39,
  205.    40,   41,   42,   43,   44,   45,   46,   47,   48,   49,
  206.    50,   51,   52,   53,   54,   55,   56,   57,   58,   59,
  207.    60,   61,   62,   63,   64,   65,   66,   67,   68,   69,
  208.    70,   71,   72,   73,   74,   75,   76,   77,   78,   79,
  209.    80,   81,   82,   83,   84,   85,   86,   87,   88,   89,
  210.    90,   91,   92,   93,   94,   95,   98,   99,   96,   97,
  211.   100,  101,  103,  104,  102,  105,  106,  107,    0,   25,
  212.    28,   29,   30,    0,   33,  108,   21,  110,   27,   26,
  213.    35,   31,   34,
  214. };
  215. short yydgoto[] = {                                       1,
  216.    15,   18,   16,   99,   23,  107,   24,   25,  100,  101,
  217.   102,  103,  104,  105,   26,
  218. };
  219. short yysindex[] = {                                      0,
  220.   175,    0,    0,    0,    0,    0,    0,    0,    0,    0,
  221.     0,    0,    0,    0,    0, -182,    0,  161,    0,    0,
  222.     0,    0,  148, -254, -253,    0,    0,    0,    0,    0,
  223.     0,    0,    0,    0,    0,    0,    0,    0,    0,    0,
  224.     0,    0,    0,    0,    0,    0,    0,    0,    0,    0,
  225.     0,    0,    0,    0,    0,    0,    0,    0,    0,    0,
  226.     0,    0,    0,    0,    0,    0,    0,    0,    0,    0,
  227.     0,    0,    0,    0,    0,    0,    0,    0,    0,    0,
  228.     0,    0,    0,    0,    0,    0,    0,    0,    0,    0,
  229.     0,    0,    0,    0,    0,    0,    0,    0,  -80,    0,
  230.     0,    0,    0,   73,    0,    0,    0,    0,    0,    0,
  231.     0,    0,    0,
  232. };
  233. short yyrindex[] = {                                      0,
  234.     0,    0,    0,    0,    0,    0,    0,    0,    0,    0,
  235.     0,    0,    0,    0,    0, -258,    0,   -3,    0,    0,
  236.     0,    0,    0,    0, -169,    0,    0,    0,    0,    0,
  237.     0,    0,    0,    0,    0,    0,    0,    0,    0,    0,
  238.     0,    0,    0,    0,    0,    0,    0,    0,    0,    0,
  239.     0,    0,    0,    0,    0,    0,    0,    0,    0,    0,
  240.     0,    0,    0,    0,    0,    0,    0,    0,    0,    0,
  241.     0,    0,    0,    0,    0,    0,    0,    0,    0,    0,
  242.     0,    0,    0,    0,    0,    0,    0,    0,    0,    0,
  243.     0,    0,    0,    0,    0,    0,    0,    0,  163,    0,
  244.     0,    0,    0,  156,    0,    0,    0,    0,    0,    0,
  245.     0,    0,    0,
  246. };
  247. short yygindex[] = {                                      0,
  248.     0,    0,    0,    0,    0,    0,    0,    0,  -19,    0,
  249.     0,  -23,    0,  -22,   58,
  250. };
  251. #define YYTABLESIZE 523
  252. short yytable[] = {                                      17,
  253.    17,   17,   17,   17,   17,   17,   17,   17,   17,   17,
  254.    17,   17,   17,   17,   17,   17,   17,   17,   17,   17,
  255.    17,   17,   17,   17,   17,   17,   17,   17,   17,   17,
  256.    17,   17,   17,   17,   17,   17,   17,   17,   17,   17,
  257.    17,   17,   17,   17,   17,   17,   17,   17,   17,   17,
  258.    17,   17,   17,   17,   17,   17,   17,   17,   17,   17,
  259.    17,   17,   17,   17,   17,   17,   17,   17,   17,   17,
  260.    17,   17,   17,   17,   17,   17,   19,   20,  106,  110,
  261.   112,  113,  108,    0,    0,    0,    0,   17,   22,   22,
  262.    22,   22,   22,   22,   22,   22,   22,   22,   22,   22,
  263.    22,   22,   22,   22,   22,   22,   22,   22,   22,   22,
  264.    22,   22,   22,   22,   22,   22,   22,   22,   22,   22,
  265.    22,   22,   22,   22,   22,   22,   22,   22,   22,   22,
  266.    22,   22,   22,   22,   22,   22,   22,   22,   22,   22,
  267.    22,   22,   22,   22,   22,   22,   22,   22,   22,   22,
  268.    22,   22,   22,   22,   22,   22,   22,   22,   22,   22,
  269.     0,    0,    0,   22,   22,    0,    0,    0,    0,    0,
  270.     0,    0,    0,    0,    0,    0,   22,   27,   28,   29,
  271.    30,   31,   32,   33,   34,   35,   36,   37,   38,   39,
  272.    40,   41,   42,   43,   44,   45,   46,   47,   48,   49,
  273.    50,   51,   52,   53,   54,   55,   56,   57,   58,   59,
  274.    60,   61,   62,   63,   64,   65,   66,   67,   68,   69,
  275.    70,   71,   72,   73,   74,   75,   76,   77,   78,   79,
  276.    80,   81,   82,   83,   84,   85,   86,   87,   88,   89,
  277.    90,   91,   92,   93,   94,   95,   96,   97,   98,    0,
  278.     0,    0,    0,  109,   18,   18,   18,   18,   18,   18,
  279.    18,   18,   18,   18,   18,   18,   18,   18,   18,   18,
  280.    18,   18,   18,   18,   18,   18,   18,   18,   18,   18,
  281.    18,   18,   18,   18,   18,   18,   18,   18,   18,   18,
  282.    18,   18,   18,   18,   18,   18,   18,   18,   18,   18,
  283.    18,   18,   18,   18,   18,   18,   18,   18,   18,   18,
  284.    18,   18,   18,   18,   18,   18,   18,   18,   18,   18,
  285.    18,   18,   18,   18,   18,   18,    0,    0,    0,   20,
  286.    27,   28,   29,   30,   31,   32,   33,   34,   35,   36,
  287.    37,   38,   39,   40,   41,   42,   43,   44,   45,   46,
  288.    47,   48,   49,   50,   51,   52,   53,   54,   55,   56,
  289.    57,   58,   59,   60,   61,   62,   63,   64,   65,   66,
  290.    67,   68,   69,   70,   71,   72,   73,   74,   75,   76,
  291.    77,   78,   79,   80,   81,   82,   83,   84,   85,   86,
  292.    87,   88,   89,   90,    0,    0,    0,    0,    0,    0,
  293.     0,    0,    0,    0,  111,   27,   28,   29,   30,   31,
  294.    32,   33,   34,   35,   36,   37,   38,   39,   40,   41,
  295.    42,   43,   44,   45,   46,   47,   48,   49,   50,   51,
  296.    52,   53,   54,   55,   56,   57,   58,   59,   60,   61,
  297.    62,   63,   64,   65,   66,   67,   68,   69,   70,   71,
  298.    72,   73,   74,   75,   76,   77,   78,   79,   80,   81,
  299.    82,   83,   84,   85,   86,   87,   88,   89,   90,   91,
  300.    92,   93,   94,   95,   96,   97,   98,   32,   32,   32,
  301.    32,   32,   32,   32,   32,   32,   32,    0,   32,   32,
  302.    19,   20,   19,   19,   21,   19,    0,    0,    0,    0,
  303.     0,   32,    0,    0,    0,    0,   22,    0,   19,    2,
  304.     3,    4,    5,    6,    7,    8,    9,   10,   11,   12,
  305.     0,   13,   14,
  306. };
  307. short yycheck[] = {                                     258,
  308.   259,  260,  261,  262,  263,  264,  265,  266,  267,  268,
  309.   269,  270,  271,  272,  273,  274,  275,  276,  277,  278,
  310.   279,  280,  281,  282,  283,  284,  285,  286,  287,  288,
  311.   289,  290,  291,  292,  293,  294,  295,  296,  297,  298,
  312.   299,  300,  301,  302,  303,  304,  305,  306,  307,  308,
  313.   309,  310,  311,  312,  313,  314,  315,  316,  317,  318,
  314.   319,  320,  321,  322,  323,  324,  325,  326,  327,  328,
  315.   329,  330,  331,  256,  333,  334,  330,  331,  333,   99,
  316.   104,  104,   25,   -1,   -1,   -1,   -1,  346,  258,  259,
  317.   260,  261,  262,  263,  264,  265,  266,  267,  268,  269,
  318.   270,  271,  272,  273,  274,  275,  276,  277,  278,  279,
  319.   280,  281,  282,  283,  284,  285,  286,  287,  288,  289,
  320.   290,  291,  292,  293,  294,  295,  296,  297,  298,  299,
  321.   300,  301,  302,  303,  304,  305,  306,  307,  308,  309,
  322.   310,  311,  312,  313,  314,  315,  316,  317,  318,  319,
  323.   320,  321,  322,  323,  324,  325,  326,  327,  328,  329,
  324.    -1,   -1,   -1,  333,  334,   -1,   -1,   -1,   -1,   -1,
  325.    -1,   -1,   -1,   -1,   -1,   -1,  346,  258,  259,  260,
  326.   261,  262,  263,  264,  265,  266,  267,  268,  269,  270,
  327.   271,  272,  273,  274,  275,  276,  277,  278,  279,  280,
  328.   281,  282,  283,  284,  285,  286,  287,  288,  289,  290,
  329.   291,  292,  293,  294,  295,  296,  297,  298,  299,  300,
  330.   301,  302,  303,  304,  305,  306,  307,  308,  309,  310,
  331.   311,  312,  313,  314,  315,  316,  317,  318,  319,  320,
  332.   321,  322,  323,  324,  325,  326,  327,  328,  329,   -1,
  333.    -1,   -1,   -1,  334,  258,  259,  260,  261,  262,  263,
  334.   264,  265,  266,  267,  268,  269,  270,  271,  272,  273,
  335.   274,  275,  276,  277,  278,  279,  280,  281,  282,  283,
  336.   284,  285,  286,  287,  288,  289,  290,  291,  292,  293,
  337.   294,  295,  296,  297,  298,  299,  300,  301,  302,  303,
  338.   304,  305,  306,  307,  308,  309,  310,  311,  312,  313,
  339.   314,  315,  316,  317,  318,  319,  320,  321,  322,  323,
  340.   324,  325,  326,  327,  328,  329,   -1,   -1,   -1,  333,
  341.   258,  259,  260,  261,  262,  263,  264,  265,  266,  267,
  342.   268,  269,  270,  271,  272,  273,  274,  275,  276,  277,
  343.   278,  279,  280,  281,  282,  283,  284,  285,  286,  287,
  344.   288,  289,  290,  291,  292,  293,  294,  295,  296,  297,
  345.   298,  299,  300,  301,  302,  303,  304,  305,  306,  307,
  346.   308,  309,  310,  311,  312,  313,  314,  315,  316,  317,
  347.   318,  319,  320,  321,   -1,   -1,   -1,   -1,   -1,   -1,
  348.    -1,   -1,   -1,   -1,  332,  258,  259,  260,  261,  262,
  349.   263,  264,  265,  266,  267,  268,  269,  270,  271,  272,
  350.   273,  274,  275,  276,  277,  278,  279,  280,  281,  282,
  351.   283,  284,  285,  286,  287,  288,  289,  290,  291,  292,
  352.   293,  294,  295,  296,  297,  298,  299,  300,  301,  302,
  353.   303,  304,  305,  306,  307,  308,  309,  310,  311,  312,
  354.   313,  314,  315,  316,  317,  318,  319,  320,  321,  322,
  355.   323,  324,  325,  326,  327,  328,  329,  322,  323,  324,
  356.   325,  326,  327,  328,  329,  330,  331,   -1,  333,  334,
  357.   330,  331,  330,  331,  334,  333,   -1,   -1,   -1,   -1,
  358.    -1,  346,   -1,   -1,   -1,   -1,  346,   -1,  346,  335,
  359.   336,  337,  338,  339,  340,  341,  342,  343,  344,  345,
  360.    -1,  347,  348,
  361. };
  362. #define YYFINAL 1
  363. #ifndef YYDEBUG
  364. #define YYDEBUG 0
  365. #endif
  366. #define YYMAXTOKEN 348
  367. #if YYDEBUG
  368. char *yyname[] = {
  369. "end-of-file",0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
  370. 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
  371. 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
  372. 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
  373. 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
  374. 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
  375. 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,"DUMMY_TOK","A_TOK","AA_TOK",
  376. "I_TOK","II_TOK","U_TOK","UU_TOK","RI_TOK","RII_TOK","LI_TOK","LII_TOK",
  377. "AY_TOK","AAY_TOK","AI_TOK","O_TOK","OO_TOK","AU_TOK","AM_TOK","AHA_TOK",
  378. "KA_TOK","KHA_TOK","GA_TOK","GHA_TOK","NGA_TOK","CHA_TOK","CHHA_TOK","JA_TOK",
  379. "JHA_TOK","JNH_TOK","TTA_TOK","TTHA_TOK","DDA_TOK","DDHA_TOK","NNA_TOK",
  380. "TA_TOK","THA_TOK","DA_TOK","DHA_TOK","NA_TOK","PA_TOK","PHA_TOK","BA_TOK",
  381. "BHA_TOK","MA_TOK","YA_TOK","RA_TOK","LA_TOK","VA_TOK","SHA_TOK","SHHA_TOK",
  382. "SA_TOK","HA_TOK","LDA_TOK","KSHA_TOK","GYA_TOK","NNX_TOK","NYA_TOK","RRA_TOK",
  383. "KADOT_TOK","KHADOT_TOK","GADOT_TOK","DDADOT_TOK","DDHADOT_TOK","JADOT_TOK",
  384. "PHADOT_TOK","RA_HALF_TOK","ANUSVARA_TOK","CHANDRA_TOK","CHANDRA_BN_TOK",
  385. "VIRAAM_TOK","AVAGRAHA_TOK","SRI_TOK","AUM_TOK","BLANK_TOK","NEWLINE_TOK",
  386. "NOLIG_TOK","COMMAND_TOK","ENDPREV_TOK","ILANG_TOK","MARATHI_TOK","HINDI_TOK",
  387. "TAMIL_TOK","BENGALI_TOK","TELUGU_TOK","MALAYALAM_TOK","GUJARATI_TOK",
  388. "ORIYA_TOK","KANNADA_TOK","SANSKRIT_TOK","ENDLANG_TOK","SETIFM_TOK",
  389. "SETFONT_TOK",
  390. };
  391. char *yyrule[] = {
  392. "$accept : intext",
  393. "intext :",
  394. "intext : intext SETIFM_TOK",
  395. "intext : intext SETFONT_TOK",
  396. "$$1 :",
  397. "intext : intext language $$1 dinput ENDLANG_TOK",
  398. "language : MARATHI_TOK",
  399. "language : HINDI_TOK",
  400. "language : ILANG_TOK",
  401. "language : TAMIL_TOK",
  402. "language : SANSKRIT_TOK",
  403. "language : BENGALI_TOK",
  404. "language : TELUGU_TOK",
  405. "language : MALAYALAM_TOK",
  406. "language : GUJARATI_TOK",
  407. "language : ORIYA_TOK",
  408. "language : KANNADA_TOK",
  409. "dinput :",
  410. "$$2 :",
  411. "dinput : dinput $$2 word",
  412. "$$3 :",
  413. "dinput : dinput $$3 command",
  414. "dinput : dinput spaces",
  415. "dinput : dinput ENDPREV_TOK",
  416. "dinput : error",
  417. "word : oletter",
  418. "word : word oletter",
  419. "word : word ENDPREV_TOK",
  420. "oletter : letter",
  421. "oletter : special",
  422. "letter : vowel",
  423. "letter : consonants vowel",
  424. "letter : consonants",
  425. "consonants : consonant",
  426. "consonants : consonants consonant",
  427. "consonants : consonants NOLIG_TOK",
  428. "vowel : A_TOK",
  429. "vowel : AA_TOK",
  430. "vowel : I_TOK",
  431. "vowel : II_TOK",
  432. "vowel : U_TOK",
  433. "vowel : UU_TOK",
  434. "vowel : RI_TOK",
  435. "vowel : RII_TOK",
  436. "vowel : LI_TOK",
  437. "vowel : LII_TOK",
  438. "vowel : AY_TOK",
  439. "vowel : AAY_TOK",
  440. "vowel : AI_TOK",
  441. "vowel : O_TOK",
  442. "vowel : OO_TOK",
  443. "vowel : AU_TOK",
  444. "vowel : AM_TOK",
  445. "vowel : AHA_TOK",
  446. "consonant : KA_TOK",
  447. "consonant : KHA_TOK",
  448. "consonant : GA_TOK",
  449. "consonant : GHA_TOK",
  450. "consonant : NGA_TOK",
  451. "consonant : CHA_TOK",
  452. "consonant : CHHA_TOK",
  453. "consonant : JA_TOK",
  454. "consonant : JHA_TOK",
  455. "consonant : JNH_TOK",
  456. "consonant : TTA_TOK",
  457. "consonant : TTHA_TOK",
  458. "consonant : DDA_TOK",
  459. "consonant : DDHA_TOK",
  460. "consonant : NNA_TOK",
  461. "consonant : TA_TOK",
  462. "consonant : THA_TOK",
  463. "consonant : DA_TOK",
  464. "consonant : DHA_TOK",
  465. "consonant : NA_TOK",
  466. "consonant : PA_TOK",
  467. "consonant : PHA_TOK",
  468. "consonant : BA_TOK",
  469. "consonant : BHA_TOK",
  470. "consonant : MA_TOK",
  471. "consonant : YA_TOK",
  472. "consonant : RA_TOK",
  473. "consonant : LA_TOK",
  474. "consonant : VA_TOK",
  475. "consonant : SHA_TOK",
  476. "consonant : SHHA_TOK",
  477. "consonant : SA_TOK",
  478. "consonant : HA_TOK",
  479. "consonant : LDA_TOK",
  480. "consonant : KSHA_TOK",
  481. "consonant : GYA_TOK",
  482. "consonant : NNX_TOK",
  483. "consonant : NYA_TOK",
  484. "consonant : RRA_TOK",
  485. "consonant : KADOT_TOK",
  486. "consonant : KHADOT_TOK",
  487. "consonant : GADOT_TOK",
  488. "consonant : JADOT_TOK",
  489. "consonant : PHADOT_TOK",
  490. "consonant : DDADOT_TOK",
  491. "consonant : DDHADOT_TOK",
  492. "special : RA_HALF_TOK",
  493. "special : ANUSVARA_TOK",
  494. "special : VIRAAM_TOK",
  495. "special : CHANDRA_TOK",
  496. "special : CHANDRA_BN_TOK",
  497. "special : AVAGRAHA_TOK",
  498. "special : SRI_TOK",
  499. "special : AUM_TOK",
  500. "command : COMMAND_TOK",
  501. "spaces : space",
  502. "spaces : spaces space",
  503. "space : BLANK_TOK",
  504. "space : NEWLINE_TOK",
  505. };
  506. #endif
  507. #ifndef YYSTYPE
  508. typedef int YYSTYPE;
  509. #endif
  510. #define yyclearin (yychar=(-1))
  511. #define yyerrok (yyerrflag=0)
  512. #ifdef YYSTACKSIZE
  513. #ifndef YYMAXDEPTH
  514. #define YYMAXDEPTH YYSTACKSIZE
  515. #endif
  516. #else
  517. #ifdef YYMAXDEPTH
  518. #define YYSTACKSIZE YYMAXDEPTH
  519. #else
  520. #define YYSTACKSIZE 600
  521. #define YYMAXDEPTH 600
  522. #endif
  523. #endif
  524. int yydebug;
  525. int yynerrs;
  526. int yyerrflag;
  527. int yychar;
  528. short *yyssp;
  529. YYSTYPE *yyvsp;
  530. YYSTYPE yyval;
  531. YYSTYPE yylval;
  532. short yyss[YYSTACKSIZE];
  533. YYSTYPE yyvs[YYSTACKSIZE];
  534. #define yystacksize YYSTACKSIZE
  535. #line 238 "iyacc.y"
  536. /*========================================================================== */
  537. /* redefining yyerror to print out yytext, lineno, etc */
  538. yyerror(s) char*s; {
  539.     fprintf(stderr,"(%s) Error at/after line %d,  before word (%s) Seen (%s)\n",
  540.         s, G_lineno, yytext, S_word.word);
  541. }
  542.  
  543. /*========================================================================== */
  544. /*
  545.  * Internal functions
  546.  */
  547.  
  548. static void S_init_word()
  549. {
  550.     /* send the previous word output to process_init_word() */
  551.     process_init_word(S_word.word);
  552.     S_word.word[0] = '\0';
  553.     S_init_letter();
  554.  
  555. }
  556.  
  557. static void S_init_letter()
  558. {
  559.     /*
  560.     fprintf(stderr, "INIT_LETTER\n");
  561.     */
  562.     S_word.curr_letter_n = 0;
  563. }
  564. static void S_end_word()
  565. {
  566.     process_end_word(S_word.word);
  567. }
  568.  
  569. /* S_handle_other is called on a ENDPREV_TOK---ilex.l gives that
  570.  * token when a punctuation, etc is seen.
  571.  * This implies that the current word, if any must be output before
  572.  * outputting the chars in yytext.
  573.  */
  574. static void S_handle_other(char* inp)
  575. {
  576.     int i, j;
  577.     j = strlen(inp);
  578.     for (i = 0; i < j; i ++) {
  579.     process_otherchar(inp[0]);
  580.     }
  581. }
  582.  
  583. static void S_init_command()
  584. {
  585.     /* NOTHING */
  586. }
  587. static void S_end_command()
  588. {
  589.     /* NOTHING */
  590. }
  591.  
  592. static void S_end_letter()
  593. {
  594.     int i;
  595.     letter_t out;
  596.     extern int S_lang_tok;
  597.  
  598.     if (S_word.curr_letter_n <= 0) return;
  599.  
  600.     for (i = 0; i < S_word.curr_letter_n-1; i ++) {
  601.     out.cons[i] = S_word.curr_letter[i];
  602.     out.nolig[i] = S_word.nolig[i];
  603.     }
  604.     out.v = S_word.curr_letter[i];
  605.     out.n = S_word.curr_letter_n - 1;
  606.     out.type = S_word.curr_type;
  607.            /* is correct only for
  608.         * VOWEL, CONSONANT_SINGLE and SPECIAL types 
  609.         */
  610.     /* check type for correctness */
  611.     if (out.type == CONSONANT_DOUBLE_TYPE && out.n > 2) {
  612.     out.type = CONSONANT_MANY_TYPE;
  613.     } else if (out.type == SPECIAL_TYPE) {
  614.     out.cons[0] = out.v; /* all specials printed out in IMPLICIT form */
  615.     out.n = 1;
  616.     }
  617.  
  618. #ifdef DEBUG
  619.     fprintf(stderr, "end_letter:out: type %d n %d v %d CONS: ",
  620.     out.type, out.n, out.v);
  621.     for (i = 0; i < out.n; i ++) {
  622.     fprintf(stderr, " %d ", out.cons[i]);
  623.     }
  624.     fprintf(stderr, "\n");
  625. #endif /*DEBUG*/
  626.  
  627.     /* process letter, language specific hijinks... */
  628.     if (G_current_font->use_ligatures == FALSE) {
  629.     /* tamil, etc does not have ligatures, process each consonant
  630.      * separately
  631.      */
  632.  
  633.     if (   out.type == CONSONANT_DOUBLE_TYPE
  634.         || out.type == CONSONANT_MANY_TYPE) {
  635.  
  636.         out.type = CONSONANT_SINGLE_TYPE;
  637.         for (i = 0; i < S_word.curr_letter_n-1; i ++) {
  638.         if (i == (S_word.curr_letter_n-2)) {
  639.             out.v = S_word.curr_letter[i+1];
  640.         } else {
  641.             out.v = HALF_FORM;
  642.         }
  643.         out.n = 1;
  644.         out.cons[0] = S_word.curr_letter[i];
  645.                 process_letter(out);
  646.         }
  647.     } else {
  648.             process_letter(out);
  649.     }
  650.  
  651.     } else { /* use ligatures, use letter as composed */
  652.         process_letter(out);
  653.     }
  654.  
  655.     S_init_letter();
  656. }
  657.  
  658. /* in_letter() returns TRUE if the parser is in the middle of scanning
  659.  * some letter --- used by ilex.l to return ENDPREV_TOK if needed.
  660.  */
  661. int in_letter()
  662. {
  663.     return (S_word.curr_letter_n > 0);
  664. }
  665. #line 666 "y_tab.c"
  666. #define YYABORT goto yyabort
  667. #define YYACCEPT goto yyaccept
  668. #define YYERROR goto yyerrlab
  669. int
  670. yyparse()
  671. {
  672.     register int yym, yyn, yystate;
  673. #if YYDEBUG
  674.     register char *yys;
  675.     extern char *getenv();
  676.  
  677.     if (yys = getenv("YYDEBUG"))
  678.     {
  679.         yyn = *yys;
  680.         if (yyn >= '0' && yyn <= '9')
  681.             yydebug = yyn - '0';
  682.     }
  683. #endif
  684.  
  685.     yynerrs = 0;
  686.     yyerrflag = 0;
  687.     yychar = (-1);
  688.  
  689.     yyssp = yyss;
  690.     yyvsp = yyvs;
  691.     *yyssp = yystate = 0;
  692.  
  693. yyloop:
  694.     if (yyn = yydefred[yystate]) goto yyreduce;
  695.     if (yychar < 0)
  696.     {
  697.         if ((yychar = yylex()) < 0) yychar = 0;
  698. #if YYDEBUG
  699.         if (yydebug)
  700.         {
  701.             yys = 0;
  702.             if (yychar <= YYMAXTOKEN) yys = yyname[yychar];
  703.             if (!yys) yys = "illegal-symbol";
  704.             printf("yydebug: state %d, reading %d (%s)\n", yystate,
  705.                     yychar, yys);
  706.         }
  707. #endif
  708.     }
  709.     if ((yyn = yysindex[yystate]) && (yyn += yychar) >= 0 &&
  710.             yyn <= YYTABLESIZE && yycheck[yyn] == yychar)
  711.     {
  712. #if YYDEBUG
  713.         if (yydebug)
  714.             printf("yydebug: state %d, shifting to state %d\n",
  715.                     yystate, yytable[yyn]);
  716. #endif
  717.         if (yyssp >= yyss + yystacksize - 1)
  718.         {
  719.             goto yyoverflow;
  720.         }
  721.         *++yyssp = yystate = yytable[yyn];
  722.         *++yyvsp = yylval;
  723.         yychar = (-1);
  724.         if (yyerrflag > 0)  --yyerrflag;
  725.         goto yyloop;
  726.     }
  727.     if ((yyn = yyrindex[yystate]) && (yyn += yychar) >= 0 &&
  728.             yyn <= YYTABLESIZE && yycheck[yyn] == yychar)
  729.     {
  730.         yyn = yytable[yyn];
  731.         goto yyreduce;
  732.     }
  733.     if (yyerrflag) goto yyinrecovery;
  734. #ifdef lint
  735.     goto yynewerror;
  736. #endif
  737. yynewerror:
  738.     yyerror("syntax error");
  739. #ifdef lint
  740.     goto yyerrlab;
  741. #endif
  742. yyerrlab:
  743.     ++yynerrs;
  744. yyinrecovery:
  745.     if (yyerrflag < 3)
  746.     {
  747.         yyerrflag = 3;
  748.         for (;;)
  749.         {
  750.             if ((yyn = yysindex[*yyssp]) && (yyn += YYERRCODE) >= 0 &&
  751.                     yyn <= YYTABLESIZE && yycheck[yyn] == YYERRCODE)
  752.             {
  753. #if YYDEBUG
  754.                 if (yydebug)
  755.                     printf("yydebug: state %d, error recovery shifting\
  756.  to state %d\n", *yyssp, yytable[yyn]);
  757. #endif
  758.                 if (yyssp >= yyss + yystacksize - 1)
  759.                 {
  760.                     goto yyoverflow;
  761.                 }
  762.                 *++yyssp = yystate = yytable[yyn];
  763.                 *++yyvsp = yylval;
  764.                 goto yyloop;
  765.             }
  766.             else
  767.             {
  768. #if YYDEBUG
  769.                 if (yydebug)
  770.                     printf("yydebug: error recovery discarding state %d\n",
  771.                             *yyssp);
  772. #endif
  773.                 if (yyssp <= yyss) goto yyabort;
  774.                 --yyssp;
  775.                 --yyvsp;
  776.             }
  777.         }
  778.     }
  779.     else
  780.     {
  781.         if (yychar == 0) goto yyabort;
  782. #if YYDEBUG
  783.         if (yydebug)
  784.         {
  785.             yys = 0;
  786.             if (yychar <= YYMAXTOKEN) yys = yyname[yychar];
  787.             if (!yys) yys = "illegal-symbol";
  788.             printf("yydebug: state %d, error recovery discards token %d (%s)\n",
  789.                     yystate, yychar, yys);
  790.         }
  791. #endif
  792.         yychar = (-1);
  793.         goto yyloop;
  794.     }
  795. yyreduce:
  796. #if YYDEBUG
  797.     if (yydebug)
  798.         printf("yydebug: state %d, reducing by rule %d (%s)\n",
  799.                 yystate, yyn, yyrule[yyn]);
  800. #endif
  801.     yym = yylen[yyn];
  802.     yyval = yyvsp[1-yym];
  803.     switch (yyn)
  804.     {
  805. case 2:
  806. #line 115 "iyacc.y"
  807. {setifm(yyvsp[0], yytext);}
  808. break;
  809. case 3:
  810. #line 117 "iyacc.y"
  811. {setfontcmd(yyvsp[0], yytext);}
  812. break;
  813. case 4:
  814. #line 120 "iyacc.y"
  815. {process_istart(yyvsp[0]);}
  816. break;
  817. case 5:
  818. #line 122 "iyacc.y"
  819. {process_iend();}
  820. break;
  821. case 6:
  822. #line 125 "iyacc.y"
  823. {yyval = MARATHI_TOK;}
  824. break;
  825. case 7:
  826. #line 126 "iyacc.y"
  827. {yyval = HINDI_TOK;}
  828. break;
  829. case 8:
  830. #line 127 "iyacc.y"
  831. {yyval = ILANG_TOK;}
  832. break;
  833. case 9:
  834. #line 128 "iyacc.y"
  835. {yyval = TAMIL_TOK;}
  836. break;
  837. case 10:
  838. #line 129 "iyacc.y"
  839. {yyval = SANSKRIT_TOK;}
  840. break;
  841. case 11:
  842. #line 130 "iyacc.y"
  843. {yyval = BENGALI_TOK;}
  844. break;
  845. case 12:
  846. #line 131 "iyacc.y"
  847. {yyval = TELUGU_TOK;}
  848. break;
  849. case 13:
  850. #line 132 "iyacc.y"
  851. {yyval = MALAYALAM_TOK;}
  852. break;
  853. case 14:
  854. #line 133 "iyacc.y"
  855. {yyval = GUJARATI_TOK;}
  856. break;
  857. case 15:
  858. #line 134 "iyacc.y"
  859. {yyval = ORIYA_TOK;}
  860. break;
  861. case 16:
  862. #line 135 "iyacc.y"
  863. {yyval = KANNADA_TOK;}
  864. break;
  865. case 18:
  866. #line 141 "iyacc.y"
  867. { S_init_word(); }
  868. break;
  869. case 19:
  870. #line 142 "iyacc.y"
  871. { S_end_word(); }
  872. break;
  873. case 20:
  874. #line 144 "iyacc.y"
  875. { S_init_command(); }
  876. break;
  877. case 21:
  878. #line 145 "iyacc.y"
  879. { S_end_command(); }
  880. break;
  881. case 23:
  882. #line 148 "iyacc.y"
  883. { S_handle_other(G_endprev_str);}
  884. break;
  885. case 25:
  886. #line 153 "iyacc.y"
  887. { S_end_letter(); }
  888. break;
  889. case 26:
  890. #line 154 "iyacc.y"
  891. { S_end_letter(); }
  892. break;
  893. case 27:
  894. #line 155 "iyacc.y"
  895. { S_end_letter();
  896.                       S_handle_other(G_endprev_str);}
  897. break;
  898. case 29:
  899. #line 160 "iyacc.y"
  900. { ADD_TOKEN_TYPE(yyvsp[0], SPECIAL_TYPE); }
  901. break;
  902. case 30:
  903. #line 163 "iyacc.y"
  904. { ADD_TOKEN_TYPE(yyvsp[0], VOWEL_TYPE); }
  905. break;
  906. case 31:
  907. #line 165 "iyacc.y"
  908. { ADD_TOKEN(yyvsp[0]);}
  909. break;
  910. case 32:
  911. #line 167 "iyacc.y"
  912. { /*
  913.                        * all consonants must end in
  914.                        * a vowel.
  915.                        * Assume vowel is Half-Form
  916.                        * here.
  917.                        */
  918.                       ADD_TOKEN( HALF_FORM );
  919.                     }
  920. break;
  921. case 33:
  922. #line 177 "iyacc.y"
  923. { ADD_TOKEN_TYPE(yyvsp[0], CONSONANT_SINGLE_TYPE);}
  924. break;
  925. case 34:
  926. #line 180 "iyacc.y"
  927. { ADD_TOKEN_TYPE(yyvsp[0], CONSONANT_DOUBLE_TYPE);}
  928. break;
  929. case 35:
  930. #line 183 "iyacc.y"
  931. { S_word.nolig[S_word.curr_letter_n-1] = TRUE;}
  932. break;
  933. case 108:
  934. #line 227 "iyacc.y"
  935. { process_command(yytext); }
  936. break;
  937. case 111:
  938. #line 233 "iyacc.y"
  939. { process_space(); }
  940. break;
  941. case 112:
  942. #line 234 "iyacc.y"
  943. { process_newline(); }
  944. break;
  945. #line 946 "y_tab.c"
  946.     }
  947.     yyssp -= yym;
  948.     yystate = *yyssp;
  949.     yyvsp -= yym;
  950.     yym = yylhs[yyn];
  951.     if (yystate == 0 && yym == 0)
  952.     {
  953. #if YYDEBUG
  954.         if (yydebug)
  955.             printf("yydebug: after reduction, shifting from state 0 to\
  956.  state %d\n", YYFINAL);
  957. #endif
  958.         yystate = YYFINAL;
  959.         *++yyssp = YYFINAL;
  960.         *++yyvsp = yyval;
  961.         if (yychar < 0)
  962.         {
  963.             if ((yychar = yylex()) < 0) yychar = 0;
  964. #if YYDEBUG
  965.             if (yydebug)
  966.             {
  967.                 yys = 0;
  968.                 if (yychar <= YYMAXTOKEN) yys = yyname[yychar];
  969.                 if (!yys) yys = "illegal-symbol";
  970.                 printf("yydebug: state %d, reading %d (%s)\n",
  971.                         YYFINAL, yychar, yys);
  972.             }
  973. #endif
  974.         }
  975.         if (yychar == 0) goto yyaccept;
  976.         goto yyloop;
  977.     }
  978.     if ((yyn = yygindex[yym]) && (yyn += yystate) >= 0 &&
  979.             yyn <= YYTABLESIZE && yycheck[yyn] == yystate)
  980.         yystate = yytable[yyn];
  981.     else
  982.         yystate = yydgoto[yym];
  983. #if YYDEBUG
  984.     if (yydebug)
  985.         printf("yydebug: after reduction, shifting from state %d \
  986. to state %d\n", *yyssp, yystate);
  987. #endif
  988.     if (yyssp >= yyss + yystacksize - 1)
  989.     {
  990.         goto yyoverflow;
  991.     }
  992.     *++yyssp = yystate;
  993.     *++yyvsp = yyval;
  994.     goto yyloop;
  995. yyoverflow:
  996.     yyerror("yacc stack overflow");
  997. yyabort:
  998.     return (1);
  999. yyaccept:
  1000.     return (0);
  1001. }
  1002.